UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nh6TyMKfFvMHf8G8Lxwh75HE20Qmw5rCT9nSvhFlF8c='
WHERE
key_id = 'a22bdfa0e8cb5306fee4b858cb438d04e9855fd0e182ed2349da4ddb845aef94'
AND (
token = 'nh6TyMKfFvMHf8G8Lxwh75HE20Qmw5rCT9nSvhFlF8c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)