UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rycX4OgtbLubPVUX90UOA6oup/P7Yr1iifMw8Do23xc=' 
WHERE 
  key_id = 'ed0dc5b31e62c0c86b8a8e02c526dd7d12548cb6f93747e005a799ec6ae79793' 
  AND (
    token = 'rycX4OgtbLubPVUX90UOA6oup/P7Yr1iifMw8Do23xc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048