UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lz8gDJWb0xWJSh/E/fGLoCfFuBsuwhdwYGm+mhpi0CY='
WHERE
key_id = '709392c2ea27443e879459617e448bfef75a09518f00e0b0e0018ec5f593d9c1'
AND (
token = 'lz8gDJWb0xWJSh/E/fGLoCfFuBsuwhdwYGm+mhpi0CY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)