UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BtBoVioiBmiIbYl4TB3Tj9mPWaGiz+4syrSZMHxS62g='
WHERE
key_id = 'f343942aead1a89cd3a2fa67b23994caf124d4bf782f84ac8e967f68776ad28a'
AND (
token = 'BtBoVioiBmiIbYl4TB3Tj9mPWaGiz+4syrSZMHxS62g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)