UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DIreU6i7Od0PLjsyBv5EIOuRkXFV3JlykzpgsiBPZR0='
WHERE
key_id = 'a23ed9092ed0146aa627a514d6e0204c056d0349a2dd0ac0bdd825c97aadf117'
AND (
token = 'DIreU6i7Od0PLjsyBv5EIOuRkXFV3JlykzpgsiBPZR0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)