UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YmaCmhU7CCbwQWFAB4UCIcRYAO3+sMO5PDbdQtJKJxc=' 
WHERE 
  key_id = '3a82f12793c0b007a57587b5b953b188ff3d53d29b9c0e07415d1148f48cfc5f' 
  AND (
    token = 'YmaCmhU7CCbwQWFAB4UCIcRYAO3+sMO5PDbdQtJKJxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027