UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Yfp6rSvrjuiaUyIpDlDY5B3nyhskGp0euWgWman5yH8='
WHERE
key_id = '9b8749f17732715776615fd55946b5f23b391a3d6617e8f896da447b665477e6'
AND (
token = 'Yfp6rSvrjuiaUyIpDlDY5B3nyhskGp0euWgWman5yH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)