UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TeflQMvsgnhU6/89+MoM7KRadS0BvL1KOgre1LPNmkM='
WHERE
key_id = '39acdb139752b81411b0063b76d70b2e847b8adf5afbdf87078da810ce52c7e5'
AND (
token = 'TeflQMvsgnhU6/89+MoM7KRadS0BvL1KOgre1LPNmkM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)