UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cOX19xGvWTuk1VxdH1SWH467X6SsvwFXqFuG/ZfJM+c=' 
WHERE 
  key_id = '83089e50f00eb842160870a71852986f831a8a7739cf4a81169b1e7603495e95' 
  AND (
    token = 'cOX19xGvWTuk1VxdH1SWH467X6SsvwFXqFuG/ZfJM+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035