UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ubvHzm6w23qdP9fQs0AV51dNjfmkXiAblL+xD3PQfz0='
WHERE
key_id = '39c5e2ead35672d95c539628ae6c463bbc0bfb1679878aa83ccc162056ca5f74'
AND (
token = 'ubvHzm6w23qdP9fQs0AV51dNjfmkXiAblL+xD3PQfz0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)