UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W7JLysoSIK2MQvxr83eIIQPbKh7csGlh+eRhXtPHd7w=' 
WHERE 
  key_id = '0e9750641d7a942be52d58b06f3f7ed53252d9ff6f5e8328abc31dfd85901e0b' 
  AND (
    token = 'W7JLysoSIK2MQvxr83eIIQPbKh7csGlh+eRhXtPHd7w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052