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