UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0lM1CZryveZL2gqb1CZwIeELxDnyGPwU1CYCCkSjCks=' 
WHERE 
  key_id = 'c9552ee18c7426b8f0d52be6643ac240f3c74e3bca9761a1243fd4194ecc4510' 
  AND (
    token = '0lM1CZryveZL2gqb1CZwIeELxDnyGPwU1CYCCkSjCks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048