UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z7pRirwBTcz2QvznoH6+n9m8bPfH0pvrqwfLZuPrwnY='
WHERE
key_id = 'cac1deb35e7f642543df17c76f9ecf7d3f77e423565ff5492472784d478d5f1a'
AND (
token = 'Z7pRirwBTcz2QvznoH6+n9m8bPfH0pvrqwfLZuPrwnY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)