UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dWQ2/z+1qjJ3ti2F2jxiC9LHjLmW2K4BgJowRmQIDxg='
WHERE
key_id = 'f7bfc61e8c34603157c8565f04f11f4419094a95c1567f210e0e0193ee751489'
AND (
token = 'dWQ2/z+1qjJ3ti2F2jxiC9LHjLmW2K4BgJowRmQIDxg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)