UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9kRvUeZ9UEcK28q9V1vuKNi4hkgFbBa21FiyZ6imDiw='
WHERE
key_id = '0761e42faefc7cb5b10e3b26154cf121134928aeceb28f76936399d17508bfd3'
AND (
token = '9kRvUeZ9UEcK28q9V1vuKNi4hkgFbBa21FiyZ6imDiw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)