UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uy/oUnMrBbt3a/+iyuyVz69WTXBztlP1lxrtuBHvvTA=' 
WHERE 
  key_id = '2722e3fa9467e460ad54594e2a7e34697718f89399845393ac00eb1e00d564e5' 
  AND (
    token = 'Uy/oUnMrBbt3a/+iyuyVz69WTXBztlP1lxrtuBHvvTA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032