UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WK30DfVt8LaVOVJplTRaTpClEF140FDVifxBBg114hU=' 
WHERE 
  key_id = 'ea259c125b23fed731bf3959f13471013d353db4df448bd29cc9ea634b08814a' 
  AND (
    token = 'WK30DfVt8LaVOVJplTRaTpClEF140FDVifxBBg114hU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042