UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N3I3zpLujBYGc/CXil8ISo5XO1mfa9O30AGt4YX1gz0='
WHERE
key_id = '09e0eb82e562ac162ce3b25668e2d1001df5438870367888e7f3f075938aeaf2'
AND (
token = 'N3I3zpLujBYGc/CXil8ISo5XO1mfa9O30AGt4YX1gz0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)