UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p/hkhaf347IkTUO1+7YC9eCxl5N1KnMVRCdxU6YfPgM='
WHERE
key_id = '8f5025f0598291fb6d38a525c5baeed7e29ffd4e2be3f11d21e5dcb18e1caf3e'
AND (
token = 'p/hkhaf347IkTUO1+7YC9eCxl5N1KnMVRCdxU6YfPgM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)