UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2mQZ4OV3Rsbc5QPcoZqsiQ6YhF9eLYKed9JleHj7td0=' 
WHERE 
  key_id = '5fb40086fa58bc62d54143fb197c84044015901a10a214dcac4b15fdfdb1da19' 
  AND (
    token = '2mQZ4OV3Rsbc5QPcoZqsiQ6YhF9eLYKed9JleHj7td0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037