UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pTP5j9jqWD0syofHs0mkqNpqOYSDvb+NyzKYwoorIeg=' 
WHERE 
  key_id = 'aac37f4dbe60bf613ca6ce774571a20ed962486ca065665f8e78a5adf3c5974c' 
  AND (
    token = 'pTP5j9jqWD0syofHs0mkqNpqOYSDvb+NyzKYwoorIeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029