UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w7BfBREOCRfry4V2JdjDuOZVm36xMsvnW+ug1OKR2Jk='
WHERE
key_id = 'e33eca25089798037b7ca309d3883a72788309e4b2047b1c3753f0aa368d25a9'
AND (
token = 'w7BfBREOCRfry4V2JdjDuOZVm36xMsvnW+ug1OKR2Jk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)