UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Kca+sYIC4VMkQCmwldKseGoId6BT3is2kVEqDyc9P+A='
WHERE
key_id = '52b9d65dcdcc9e9c0133c2912ba7ae5174657c298279cfedef2d2975c64b5d10'
AND (
token = 'Kca+sYIC4VMkQCmwldKseGoId6BT3is2kVEqDyc9P+A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)