UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yLLw/SgEzD0WInXYQcBETME1bYvpbkm1mbvU3P7v3/Y=' 
WHERE 
  key_id = 'c39fbac7788eac7aaebd872ad04b189b4c3e5d139ec7e3a8068e090f1e4df91c' 
  AND (
    token = 'yLLw/SgEzD0WInXYQcBETME1bYvpbkm1mbvU3P7v3/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041