UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H50CD9d932ZHjjHGzXNrINjxLqELQLn1xvTMT7i/Vik='
WHERE
key_id = '01d253b8146cfae55a564203541c4cd29bd2c138855f7335db61f1b977ac2604'
AND (
token = 'H50CD9d932ZHjjHGzXNrINjxLqELQLn1xvTMT7i/Vik='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)