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