UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g+2x1p8T0TWQL4yFSlBdTAFDqZnpFjJbVzJiGeFUCvI=' 
WHERE 
  key_id = '64b63ffd939df09cc67b8859302e9143da85d5874eb281fe9b736e819964b6db' 
  AND (
    token = 'g+2x1p8T0TWQL4yFSlBdTAFDqZnpFjJbVzJiGeFUCvI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016