UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+liSRjtsWpP0N1VdY0UHea/vxqsXJIn19C/u3Gjyw4I=' 
WHERE 
  key_id = '2248cca50e2aaf2aa472062fb466958739e9a24d82b21f7f354e4d8a743bea94' 
  AND (
    token = '+liSRjtsWpP0N1VdY0UHea/vxqsXJIn19C/u3Gjyw4I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038