UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ac1PI8ahs3MOWAkXxzvZiYWzkRko9UW47L0EMOvR6gk='
WHERE
key_id = 'af7c60bd2068b496926b0c36057077a32e60067c5c7f62553dcc044a5f1dbefc'
AND (
token = 'Ac1PI8ahs3MOWAkXxzvZiYWzkRko9UW47L0EMOvR6gk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)