UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V49Qw+x3PFZBtIDSeM0dc4L581slZKdl+4G2EifSJsM='
WHERE
key_id = 'a3c1acc391c0d92601b546fa41094c11ef39a8702be4f4ec63d289a42d4627c0'
AND (
token = 'V49Qw+x3PFZBtIDSeM0dc4L581slZKdl+4G2EifSJsM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)