UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KN8C4AS53mHR4ASxAggF8BytTkTLRq+rxLCSwkRUeco='
WHERE
key_id = 'c5e330e99208aafc1f908f331c31c7b6fbcb40fac33a625cb4cc5199ec7f1780'
AND (
token = 'KN8C4AS53mHR4ASxAggF8BytTkTLRq+rxLCSwkRUeco='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)