UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qS3cFVixBLF/+gZUy9SmNT7UNBKBtQtsGOH4u2bknl4='
WHERE
key_id = 'abb1b9314b000e5c1bcee1e48c117f25b3e2d317b8e5256d1f4c794038268834'
AND (
token = 'qS3cFVixBLF/+gZUy9SmNT7UNBKBtQtsGOH4u2bknl4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)