UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MlXSTEvKWg5mpb64G0v2clTel+VLwRCkhY6ZJ7aOK94=' 
WHERE 
  key_id = '40c845026767ad80bf3bdb276327225b18bae490ad888f35fd2f5a024663953b' 
  AND (
    token = 'MlXSTEvKWg5mpb64G0v2clTel+VLwRCkhY6ZJ7aOK94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035