UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sZM5VxZWpf3QL0vdFTgxIUOVV24V7F9uzvzWx+Dhs0M=' 
WHERE 
  key_id = '22f7e7d7f893de0814f980dca7a0b4b4a1c0a4e9517cb5dfc692d28e8e181071' 
  AND (
    token = 'sZM5VxZWpf3QL0vdFTgxIUOVV24V7F9uzvzWx+Dhs0M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059