UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XaQURXwew/pc8nqlR3pkC4OAeDchMtLbhUy61y9YhwY='
WHERE
key_id = '5583f7547d67078fb5b75316c501964130b0e39987799103bc0bb7eabee3ef76'
AND (
token = 'XaQURXwew/pc8nqlR3pkC4OAeDchMtLbhUy61y9YhwY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)