UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Viw2MUb9L6nQ7BdR0T2AqfWHJWoHltH6UdXx6tICsOI=' 
WHERE 
  key_id = '2ad27a80968314d1ff9193f97fba1465dff8d2e39cfa2e6234779a840b335d60' 
  AND (
    token = 'Viw2MUb9L6nQ7BdR0T2AqfWHJWoHltH6UdXx6tICsOI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036