UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RJSn3Ss5wXi6f5OZuM9izPUkHyTOmD9oiJbYEn5qWpQ='
WHERE
key_id = 'b5cc3d6053f2d9c322324cc23319700080a09315f31d096d323f9c21fe4666f4'
AND (
token = 'RJSn3Ss5wXi6f5OZuM9izPUkHyTOmD9oiJbYEn5qWpQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)