UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kM6A63abK8weqzgcrJrOn4e8obRLcVQ33YQMQGr55eY=' 
WHERE 
  key_id = '39465b977f87ad1fab520842ff41e768f96510384ce9486655fa994e7e1b789d' 
  AND (
    token = 'kM6A63abK8weqzgcrJrOn4e8obRLcVQ33YQMQGr55eY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031