UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UTFdZE1PPo3bz6INPkof24BCGzWHftKOT/T9Lcw+8fo=' 
WHERE 
  key_id = '43068bae3456b83b9aab82b4eaaa221c0fd7454023b0c85474be028b5f3d7dc9' 
  AND (
    token = 'UTFdZE1PPo3bz6INPkof24BCGzWHftKOT/T9Lcw+8fo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038