UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hTED4l0CvSbwZnuAefyhdbTYup9fhk6a/0m4zOypNmY=' 
WHERE 
  key_id = '41e971146447a512b17092db14916317bd6d463902070d500cee71b0e420866d' 
  AND (
    token = 'hTED4l0CvSbwZnuAefyhdbTYup9fhk6a/0m4zOypNmY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058