UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iyhVNSb19X+ytFkyc9q/z3gPhhrtRp+ALMZTWDO71K4='
WHERE
key_id = 'eb8d39c3f06bbd699ef2c50a2edda06889137f8f99e85424506a268641f442c6'
AND (
token = 'iyhVNSb19X+ytFkyc9q/z3gPhhrtRp+ALMZTWDO71K4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)