UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V8z16rIPUdYjhUxoy7a862wABYu3y+lzDv6nL3tOwD0='
WHERE
key_id = '4f30864a3dd9a6513c14cf83e4eb2bb3f0f790e2c598f7da739c73688d133f66'
AND (
token = 'V8z16rIPUdYjhUxoy7a862wABYu3y+lzDv6nL3tOwD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)