UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z+jPuhlsE+ZBULFqqrb4V+Ue/dCCcvionojdziGVGXo='
WHERE
key_id = '1ab114adf7f61507748f850313eb1659eec0b8f1931c9e930327b8ed64de2a49'
AND (
token = 'Z+jPuhlsE+ZBULFqqrb4V+Ue/dCCcvionojdziGVGXo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)