UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ns4+y78cJDhTgBl1cy3htfZ3z8LBVR2v4tzmHd/b3EI='
WHERE
key_id = 'c47b69b55d25b8efe85973e60213207a7e1444e920a0f427aa2ad1d0d76e5a46'
AND (
token = 'ns4+y78cJDhTgBl1cy3htfZ3z8LBVR2v4tzmHd/b3EI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)