UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VYq/aWL+W1Y6b4uQmMwUIPsejHJ3oU9gMA7WaoMU3Ho=' 
WHERE 
  key_id = '3dfd8d594f3c4e161372f25a3bc11f06f76746d40c2df4ebb655b56cc315a131' 
  AND (
    token = 'VYq/aWL+W1Y6b4uQmMwUIPsejHJ3oU9gMA7WaoMU3Ho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030