UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p7T4uTI5MP02TEG0i/dhfKFGZbMQ8kdxQZMPOQKdMBc='
WHERE
key_id = 'fae14dddfd6c4dc1184a8c3badee6797ccf6a62c138e4937003a78b41b76228d'
AND (
token = 'p7T4uTI5MP02TEG0i/dhfKFGZbMQ8kdxQZMPOQKdMBc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)