UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q0pE8Ygv+RiJBBZj9SJnLOTeU6/Z4GCAQDSAoptFvBw='
WHERE
key_id = 'b4b157a24b5d2b421762780ce6d22a2535a471e01be844611b67c6b5a9141fc9'
AND (
token = 'Q0pE8Ygv+RiJBBZj9SJnLOTeU6/Z4GCAQDSAoptFvBw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)