UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wIODhEM6Ya6nbzMWDTkuCREAkamdmaO90EK+qmo55II=' 
WHERE 
  key_id = 'a1de0b92bd21ab4ffcf1f897b7615968ca664bf60a4f4ae8501d244a59272cec' 
  AND (
    token = 'wIODhEM6Ya6nbzMWDTkuCREAkamdmaO90EK+qmo55II=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032