UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2+8vJdgzO5B/G6phlGQlePFrXzgeLK0bNABbuGa1J+s='
WHERE
key_id = 'bfd5a1da52611ddc09206227b5c13899e3ef5ebba6b3a85975a6c3f3b9ea2418'
AND (
token = '2+8vJdgzO5B/G6phlGQlePFrXzgeLK0bNABbuGa1J+s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)