UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kNFHdlWmK8F93F04z2qHgi5PUFJgS2KpiN/QhZmctPc='
WHERE
key_id = 'a1d433ce1ff669d244a714d5f7a3f129480bf35adedb6640e199d9d5dcfd67b0'
AND (
token = 'kNFHdlWmK8F93F04z2qHgi5PUFJgS2KpiN/QhZmctPc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)