UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JyApIr0RShSpEJN4ysoSAoE5FFKH4186UcXRwDKE0/s=' 
WHERE 
  key_id = 'd81dd808e5de4beeb0612aa811a68f76bba4fd00c99f535a8231eb5974979f9d' 
  AND (
    token = 'JyApIr0RShSpEJN4ysoSAoE5FFKH4186UcXRwDKE0/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040