UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jh81YQuRHC21YLA07f8MqaI+EugfnQ8Mi9Rl+I9J4CY=' 
WHERE 
  key_id = 'f337c1e002fb7b7f78c47a73061b2b6a8b97a97ef4cb3d7cf2ab8b41c90575a9' 
  AND (
    token = 'Jh81YQuRHC21YLA07f8MqaI+EugfnQ8Mi9Rl+I9J4CY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036