UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tz5zq9ItQLtWs+GOKoy43ZHDqvJ8LgN4MD313VKVJi8='
WHERE
key_id = 'dacf8848316f0d98fc32576e7d855d0e7971df0aedacbae913b4d5725f08c8f7'
AND (
token = 'tz5zq9ItQLtWs+GOKoy43ZHDqvJ8LgN4MD313VKVJi8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)