UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S8ZOT6OBUrX3q+nNmDUKNvn+PxCTuazjSJuG81hZgV4='
WHERE
key_id = '6b0ecd88a5e26948a19d728da9148ad254c41ef6096f17d1817a7c9ba8b6f930'
AND (
token = 'S8ZOT6OBUrX3q+nNmDUKNvn+PxCTuazjSJuG81hZgV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)