UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HJvGcPBpkKL1b5KagbUnn+V2HsUYdSUmbP7blpXJwlA=' 
WHERE 
  key_id = '790abe888a33c779d70eb07a8f68043a214a226e4e2d1dea4b2ddfae3ad06871' 
  AND (
    token = 'HJvGcPBpkKL1b5KagbUnn+V2HsUYdSUmbP7blpXJwlA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034