UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GumBOdjsUqcoR+9jcC2709lFTufl+P4TJReNvum8zFc=' 
WHERE 
  key_id = '7d7f83a7eccd43d9835ed527337eb03df8589596831cf33b642ba952a8a5123e' 
  AND (
    token = 'GumBOdjsUqcoR+9jcC2709lFTufl+P4TJReNvum8zFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026