UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NYCW6Bm8gMJjAXOLhkyh9DRYayWw7VKDonjcAVY3gSY=' 
WHERE 
  key_id = '3729671fc32756e72d4fcce26981d5323e8c6b971c0b7d51e4f16803f754eefb' 
  AND (
    token = 'NYCW6Bm8gMJjAXOLhkyh9DRYayWw7VKDonjcAVY3gSY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035