UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '91Gz7bnx4QC3pFh8N6CnyuI2MwlxebLGrV75SEqt960='
WHERE
key_id = '39d5893932a2a1021aefa95b953f2b7811755e24e65b9824cb55aa1b091d0262'
AND (
token = '91Gz7bnx4QC3pFh8N6CnyuI2MwlxebLGrV75SEqt960='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)