UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M9eMaljUDRtyfRZa9x80PMyhfZc1G2TwwX+EBVlOEQI=' 
WHERE 
  key_id = '32a1d204610900717be7fd3ac61df3e047eff8e390b8139740650ad7c807cce2' 
  AND (
    token = 'M9eMaljUDRtyfRZa9x80PMyhfZc1G2TwwX+EBVlOEQI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028