UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aGlKiP4lKNckBVr5xySGlYrg3ZPQe+VUy0CrSWFe4Z8='
WHERE
key_id = 'd2f12b17cd529c85f661bdaa9d75aafc24d8c7aa99bd86a40c80b8024d6eade1'
AND (
token = 'aGlKiP4lKNckBVr5xySGlYrg3ZPQe+VUy0CrSWFe4Z8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)