UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qmwqWWLtzVMhOgLzAa7MemHEQ/Xw3b3sKot3ZfmcngM=' 
WHERE 
  key_id = '80a6ab9b7d1f9b08b555e79a9569e80257c241228dc2d48ce788c1d5aaf5a16e' 
  AND (
    token = 'qmwqWWLtzVMhOgLzAa7MemHEQ/Xw3b3sKot3ZfmcngM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020