UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3VQtcz7HG2jMeVA+6WtxaoBEiuxWJBFLu86wJhnB1MY=' 
WHERE 
  key_id = '665d234bb8ee91ac146d900fecbed3c42d89e40cf23ce5014d685c9673a12840' 
  AND (
    token = '3VQtcz7HG2jMeVA+6WtxaoBEiuxWJBFLu86wJhnB1MY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017