UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BXdA8ddXqbSWCwdTp0KM6L88Jh4UZtC+uzp4Vt84Xz8='
WHERE
key_id = 'fee7a393942e56c026e729c60215c73fd96f3a45ac162d93c51c9ae1b5d3bd0e'
AND (
token = 'BXdA8ddXqbSWCwdTp0KM6L88Jh4UZtC+uzp4Vt84Xz8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)